Skip to content

Conversation

Dennis40816
Copy link
Contributor

This PR improves the hook that detects non-American English in commit messages.

Previously, the hook would only indicate the presence of non-American English words without specifying their locations or the words themselves. Now, the hook clearly reports the exact line numbers and problematic words, making it easier for users to identify and correct the issues.

A test is conducted below.

Test commit

This commit intrduces a new featre to automatially detact misspelld
words in commit mesages. 

It help users to quicky indentify and fix issuses with non-Amercan
English.  This improvment provides more clearity and acuracy in the
warnning mesages displayed.

// test order
OneAndTwo should precede TwoAndOne.

TwoAndOne should precede OneAndTwo.

Before

image

After

image

@jserv
Copy link
Contributor

jserv commented Feb 25, 2025

Can you simplify the lengthy script?

@Dennis40816
Copy link
Contributor Author

Which formatter is this script using?

@jserv
Copy link
Contributor

jserv commented Feb 26, 2025

Which formatter is this script using?

I have not decided yet. You can simply follow the existing indention.

@Dennis40816
Copy link
Contributor Author

Should I squash my local commits into a single commit and then force push, or simply add a new commit?

@jserv
Copy link
Contributor

jserv commented Feb 26, 2025

Should I squash my local commits into a single commit and then force push, or simply add a new commit?

Always squash for single purpose commits.

Previously, warnings about non-American English words in commit messages
did not indicate the specific word or its exact location. This commit
improves the hook by outputting the precise line number and word that
triggered the warning.

A new function, 'get_all_match_positions', was introduced to locate the
first occurrence of each target word in a multi-line string. We now
preserve blank lines in the commit message by using the variable
'FULL_COMMIT_MSG_WITH_SPACE', so that the line search functionality
operates correctly.

This change makes it easier for users to quickly identify and correct
non-American English words in their commit messages.

Change-Id: I8a2b7eb3984b06b0be6506ca4f410ca857fe50a7
@Dennis40816 Dennis40816 force-pushed the clear-where-the-non-american-english-appears branch from 8a2428c to d39d920 Compare February 26, 2025 02:24
@jserv jserv merged commit 53aa839 into sysprog21:master Feb 26, 2025
1 of 2 checks passed
@jserv
Copy link
Contributor

jserv commented Feb 26, 2025

Thank @Dennis40816 for contributing!

Dennis40816 added a commit to Dennis40816/lab0-c that referenced this pull request Mar 3, 2025
PR sysprog21#209's functionality was broken due to changes introduced in PR sysprog21#214,
specifically in commit '4a8d8b5', where some occurrences of
'COMMIT_MSG_LINES' were replaced with 'commit_msg_lines' without
updating all relevant functions.

This commit fixes the issue by replacing all instances of
'COMMIT_MSG_LINES' with 'commit_msg_lines', ensuring consistency and
restoring the functionality introduced in PR sysprog21#209.

Change-Id: I0c93617be83c5f24b1e17678566883c0481ddc48
@Dennis40816 Dennis40816 deleted the clear-where-the-non-american-english-appears branch March 19, 2025 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants